Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ms

Package Overview
Dependencies
Maintainers
55
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ms

Tiny millisecond conversion utility

  • 2.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43M
decreased by-80.62%
Maintainers
55
Weekly downloads
 
Created

What is ms?

The 'ms' npm package is a simple utility library for parsing and formatting various time formats. It allows you to easily convert between different time units such as milliseconds, seconds, minutes, hours, and days. It is commonly used to work with durations and timeouts in a human-readable format.

What are ms's main functionalities?

Convert from milliseconds to human-readable format

This feature allows you to convert a duration in milliseconds to a string that represents the duration in a more human-readable format, such as '1m' for one minute.

"const ms = require('ms');
console.log(ms(60000)); // '1m'"

Convert from human-readable format to milliseconds

This feature enables you to convert a human-readable time format into its equivalent number of milliseconds. For example, '2 days' would be converted to 172800000 milliseconds.

"const ms = require('ms');
console.log(ms('2 days')); // 172800000"

Round trip conversion

This demonstrates a round trip conversion where a human-readable duration is first converted to milliseconds and then back to a human-readable format.

"const ms = require('ms');
const duration = ms('1 hour');
console.log(ms(duration)); // '1h'"

Other packages similar to ms

FAQs

Package last updated on 08 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc